package com.oracle.common;

import com.oracle.service.FeignGetGirlService;
import com.oracle.vo.Boy;
import com.oracle.vo.Girl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @program: CampusMatching
 * @description:
 * @author: zhaolei
 * @create: 2020-07-29 17:18
 **/
@Component
public class FeignGetGirlServiceFallbackFactory implements FallbackFactory<FeignGetGirlService> {
    @Override
    public FeignGetGirlService create(Throwable throwable) {
        return new FeignGetGirlService() {
            @Override
            public List getGirl(Boy boy) {
                System.out.println("降级了");
                List list=new ArrayList();
                Girl girl=new Girl();
                girl.setGname("白富美");
                girl.setGsex("女");
                girl.setGheight("170cm");
                girl.setGbirthday(new Date(1997 / 11 / 29));
                girl.setGschool("哈佛大学");
                girl.setGhobby("弹钢琴,冲浪");
                list.add(girl);
                return  list;
            }
        };
    }
}
